<!DOCTYPE HTML>
<html style="min-width:inherit;">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="/static/public/jquery-1.11.1.min.js" type="text/javascript"></script>
<link href="/static/public/layer/src/css/layui.css" rel="stylesheet">
<script src="/static/public/layer/src/layui.js"></script>


</head>

<body>


<form class="layui-form" style="padding-top:15px;padding-right:30px;">
  <div class="layui-form-item">

      <label class="layui-form-label">开始排课时间</label>
      <div class="layui-input-inline">
        <input type="text" name="class_time" lay-verify="date" placeholder="yyyy-mm-dd" autocomplete="off" class="layui-input" onclick="layui.laydate({elem: this, istime: false, format: 'YYYY-MM-DD'})">
      </div>

  </div>
  <div class="layui-form-item" >
    <label class="layui-form-label">周期</label>
    <div class="layui-input-inline">
      <select name="week" lay-verify="required">
        <option value=""></option>
        <option value="0" >周日</option>
        <option value="1" >周一</option>
        <option value="2" >周二</option>
        <option value="3" >周三</option>
        <option value="4" >周四</option>
        <option value="5" >周五</option>
        <option value="6" >周六</option>
        <option value="7" >全周</option>
      </select>
    </div>
  </div>
<div class="layui-form-item">
      <label class="layui-form-label">上课时间</label>

      <div class="layui-input-inline" style="width:90px;">
        <select name="hour" lay-verify="required">
          <option value="">时</option>
          <option value="8" >8点</option>
          <option value="9" >9点</option>
          <option value="10">10点</option>
          <option value="11">11点</option>
          <option value="12">12点</option>
          <option value="13" >13点</option>
          <option value="14" >14点</option>
          <option value="15">15点</option>
          <option value="16">16点</option>
          <option value="17">17点</option>
          <option value="18">18点</option>
          <option value="19">19点</option>
          <option value="20">20点</option>
          <option value="21">21点</option>
          <option value="22">22点</option>

        </select>
      </div>
      <div class="layui-input-inline" style="width:90px;">
        <select name="minute" lay-verify="required">
          <option value="">分</option>
          <option value="00" >00</option>
          <option value="05" >05</option>
          <option value="10">10</option>
          <option value="15">15</option>
          <option value="30">30</option>
          <option value="45">45</option>
        </select>
      </div>
    </div>
<div class="layui-form-item">
    <label class="layui-form-label">本次课时</label>
    <div class="layui-input-inline">
       <input type="number" name="class_hour" lay-verify="number" autocomplete="off" class="layui-input" placeholder="课时：分钟">

    </div>
  </div>


  <div class="layui-form-item">
    <label class="layui-form-label">讲师</label>
    <div class="layui-input-inline">
      <select name="teacher_id" lay-verify="required">
        <option value=""></option>
        <{foreach from=$teachers item=item}>
        <option value="<{$item['id']}>" <{if $class_info['lecturer_id']==$item['id'] }>selected<{/if}> ><{$item['teacher_name']}></option>
        <{/foreach}>
      </select>
    </div>
  </div>
<div class="layui-form-item">
    <label class="layui-form-label">教室</label>
    <div class="layui-input-inline">
      <select name="class_room" lay-verify="required">
        <option value=""></option>
        <{foreach from=$room_list item=item}>
        <option value="<{$item['id']}>" <{if $class_info['classroom']==$item['id'] }>selected<{/if}>><{$item['name']}></option>
        <{/foreach}>
      </select>
    </div>
  </div>


  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit="" lay-filter="demo1">开始排课</button>
      <!-- <button type="reset" class="layui-btn layui-btn-primary">重置</button> -->

    </div>
  </div>
</form>


<{include file="footer.html"}>
<script>
layui.use(['form', 'laydate'], function(){
  var form = layui.form()
  ,layer = layui.layer
  ,laydate = layui.laydate;



  //监听提交
  form.on('submit(demo1)', function(data){
    var class_time = $("input[name='class_time']").val();
    var week = $("select[name='week']").val();
    var hour = $("select[name='hour']").val();
    var minute = $("select[name='minute']").val();
    var class_hour = $('input[name="class_hour"]').val();
    var teacher_id = $("select[name='teacher_id']").val();
    var class_room = $("select[name='class_room']").val();


    $.post('/class_plan/auto_plan/<{$class_id}>',{'class_time':class_time,'week':week,'hour':hour,'minute':minute,'teacher_id':teacher_id,'class_room':class_room,'class_hour':class_hour},function(res){
        var obj = eval('(' + res + ')');
        if(obj.result==0){
          window.parent.save_close();
        }else {
          alert(obj.msg);
        }
    });

    return false;
  });


});
</script>



</body>
</html>
